/**
 * 
 */
package name.yzhu.httpserver.method;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import name.yzhu.httpserver.HttpReturnData;


/**
 * This interface is the root interface of http remote calling methods
 * Here are steps for define a http remote service:
 * <br>
 * 1> Define an interface inherit from {@link IHttpHandler}
 * For the method which you want to calling on remote host should be remarked by  the annotation {@link HttpMethodAnno} 
 * The parameter hrm used for identifier method name,  the other one used for retrieving parameters from http request.
 * <br>
 * <b>Note:</b> the method must need to return a byte array, for the return data structure, refer {@link HttpReturnData} <br> for example:
 * <pre><code>
 *    @HttpMethodAnno(hrm="login", parameters="name,password")
 *    byte[] login(String name, String password)
 * </code></pre>
 * 2> Create a service class implement the interface defined in step 1
 * <br>
 * 3> Create a Http2Method and add the Instance of the class defined in step2
 * <br>
 * 4> Start {@link HTTPServletServer} with the sevlet in step 3
 * @author yhzhu
 *
 */
public interface IHttpHandler {
	/**
	 * Client and Server should have the same version. otherwise , client will
	 * get IOException
	 * @return
	 */
	int version();
	/**
	 * set request and response
	 * @param req
	 * @param res
	 */
	void setReqResp(HttpServletRequest req, HttpServletResponse res);
}
